##############################################
#Figure D9: Spending Demand by OUR Over Time
#Author: Raluca L. Pahontu
##############################################

data.our <- read.dta13("shp_and_rehm_our.dta")

our1 <- ggplot(data.our,aes(x=year,y=spending_mean,colour=our, line=as.factor(isco1))) + 
  geom_point(size = 2) + scale_colour_gradient(low="black", high="red", name="OUR") + facet_wrap(~isco1) + 
  geom_line(stat = "smooth", method = "loess",  span = 1, size = 2, alpha = 0.4) + 
  theme_bw() + ylab("Mean Spending Demand") + xlab("Year") + ylim(0.3,0.8)


our2 <- ggplot(data.our,aes(x=year,y=spending_mean,colour=our, line=as.factor(isco1))) + 
  geom_line() + 
  geom_point(size = 2) + scale_colour_gradient(low="black", high="red", name="OUR") + 
  theme_bw() + ylab("Mean Spending Demand") + xlab("Year") +ylim(0.3,0.8)

ggarrange(our1, our2, ncol=2, common.legend = T)
ggsave(file="figure_d9.pdf")



